%%%-------------------------------------------------------------------
%%% File        : smtpdc.hrl
%%% Author      : Fyodor Ustinov <ufm@ufm.su>
%%% Description : part of SMTP Daemon
%%%
%%% Created     : 24 Aug 2009 by Fyodor Ustinov <ufm@ufm.su>
%%%-------------------------------------------------------------------

-include_lib("kernel/include/inet.hrl").

-define(QUEUETIMEOUT,300000).             % Yes! 5 minuts.

-record(smtpdcs, {id="",                  % Connection ID
		  csock,                  % Connected socket
		  myhostname="localhost", % Hotname
		  tref,                   % Timer reference
		  timeout=0,              % Current timeout
		  filter=0,               % Reference to filter process
		  maxtimeout=20,          % Max timeout between received lines
		  sanity = 0,             % Sanity of the message
		  time = {},              % Receiving time
		  from_ip = {},           % Sender IP
		  from_name = "unknown",  % Sender resolved name
		  mail_from = "",         % MAIL FROM:
		  rcpt_to = [],           % RCPT TO:
		  hello = {},             % {HELO|EHLO, domain}
		  data = false,           % DATA state
		  header = false,         % Receive message header
		  kludges = [],           % Header kludges
		  maxbuffer = 20480000,   % Max Buffer size
		  buffsize = 0,           % Current size
		  buffer = []             % Buffered message
		 }).


-record(mail, {id = "",                    % Message ID
	       chunks = 0,                 % chunks in storage
	       time = {},
	       sender = 'UNKNOWN',         % Sender of message (internal)
	       myhostname = "localhost",   % With this hostname we receive mail
	       sanity = 0,                 % Sanity of the message
	       from_ip = {},               % 
	       from_name = "unknown",
	       mail_from = [],
	       rcpt_to = [],
	       hello = {},
	       kludges = [],
	       buffsize = 0,
	       buffer = []
	       }).

-record(storage, {id = {"",0},
		 buffer = []
		 }).

-record(user, {dname = {},                 % User name {user,domain}
	       fname = "",                 % Full user name
	       password = "",              % User password
               node = 'noname@nodomain',   % Home node name
	       last_login = 0,             % Last access time
               mbox_size  = 0,             % Size of mailbox
	       max_mbox_size = 0,          % Max mailbox size
	       config = [],                % Configurations
	       pop3_config = [],           % Field for POP3 configuration
	       imap_config = [],           % Field for IMAP configuration
	       smtp_config = []            % Field for SMTP configuration
	       }).
